/**
 * @title 解决跨域
 * @author webxue<xueshuai_12@163.com>
 * @date 2023-02-09
 */

export class CorsLib {
  private app = null;

  constructor(app) {
    this.app = app;

    this.initialization();
  }

  initialization() {
    this.app.enableCors({
      origin: "*",
      credentials: true,
      allowedHeaders: ["Authorization", "content-type"],
      methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
      preflightContinue: false,
      optionsSuccessStatus: 204,
    });
  }
}
